package com.tywj.buscustomerapp.model;

import android.util.Log;

import com.tywj.buscustomerapp.model.bean.StationBean;
import com.tywj.buscustomerapp.presenter.contract.MapContract;
import com.tywj.buscustomerapp.utils.WebServicrUtils;

import org.xmlpull.v1.XmlPullParserException;

import java.io.ByteArrayInputStream;
import java.io.IOException;
import java.io.InputStream;
import java.util.List;

public class MapModel implements MapContract.MapModel {


    @Override
    public List<StationBean> loadData(String stationId) {
        String stringIo = null;
        List<StationBean> beans = null;
        try {
            stringIo = WebServicrUtils.getInstance().getTravelLineInfo(stationId);
            InputStream in_nocode = new ByteArrayInputStream(stringIo.getBytes("UTF-8"));
            beans = WebServicrUtils.getInstance().getStations(in_nocode);
            Log.i("taylor123",stringIo);
            return beans;
        } catch (IOException e) {
            e.printStackTrace();
        } catch (XmlPullParserException e) {
            e.printStackTrace();
        } catch (Exception e) {
            e.printStackTrace();
        }

        return beans;
    }
}
